package homework.work6;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input your birthday yyyy-MM-dd");
        String birthStr = scanner.nextLine();
//        String birthStr="2000-01-29";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date birthday = null;
        try{
            birthday = sdf.parse(birthStr);

        } catch (ParseException e) {
            // 处理解析异常
            System.out.println("日期格式解析错误：" + e.getMessage());
        }
        Date date = new Date();
        System.out.println("date-birth = " +
                (date.getTime()-birthday.getTime())/(1000*60*60*24));
    }
}